package com.dream.technology.controller;


import com.dream.technology.data.GenericRspDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.dream.technology.db.entity.RcborrowingSnapshot;
import com.dream.technology.db.entity.RcborrowingSnapshotQuery;
import com.dream.technology.service.RcborrowingSnapshotService;
import com.dream.technology.vo.ErrorCode;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("风控借款快照")
@RestController
@RequestMapping("/risk/admin/borrowing_snapshot")
public class RcBorrowingSnapshotController {

    private static final Logger logger = LoggerFactory.getLogger(RcBorrowingSnapshotController.class);


    @Autowired
    RcborrowingSnapshotService rcborrowingSnapshotService;

    /**
     * 风控借款快照
     * @param pageNum
     * @param pageSize
     * @param name
     * @param mobile
     * @param action
     * @return
     */
    @GetMapping("/list")
    public GenericRspDTO<Object> getList(Integer pageNum, Integer pageSize, String name, String mobile, Integer action){
        RcborrowingSnapshotQuery rcborrowingSnapshotQuery =new RcborrowingSnapshotQuery();
        PageHelper.startPage(pageNum,pageSize);
        List<RcborrowingSnapshot> rcborrowingSnapshotList = rcborrowingSnapshotService.selectByExample(rcborrowingSnapshotQuery);
        PageInfo pageInfo =new PageInfo(rcborrowingSnapshotList);

        return GenericRspDTO.newInstance(ErrorCode.SUCCESS.getErrorCode(), ErrorCode.SUCCESS.getErrorMsg(), pageInfo);
    }
}
